import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

/**
 * Module Name: ObjectFile
 * 
 * Description: This class creates and manages the entries in the Object File
 * table. Refer to page 8 in the lab specs guide.
 * 
 * Calling Sequence: ObjectFile objectFile = new ObjectFile();
 * 
 * Input Parameters:
 * 
 * Output Parameters:
 * 
 * Error Conditions Tested:
 * 
 * Error Messages Generated:
 * 
 * Original Author:
 * 
 * Procedure Creation Date:
 * 
 * Modification Log: Who/When/Why
 * 
 * Coding Standards Met: "Signed Code Leader(Jaron)"
 * 
 * Testing Standards Met: "Signed Test Leader(Jamie)"
 */

public class ObjectFile {

	// header record
	protected static String moduleName = "DefaultName";
	private static Integer programLength = 0;
	protected static Integer loadAddress = 0;
	private static Integer numberOfLinkingRecords = 0;
	private static Integer numberOfTextRecords = 0;
	protected static Integer startAddress = 0;
	private static String tressel = "TRESSEL";
	private static String versionNumber = "3";
	private static String revisionNumber = "2";

	// linking record
	private static ArrayList<String> entryNameArray = new ArrayList<String>(0);
	private static ArrayList<Integer> entryAddressArray = new ArrayList<Integer>(0);
	private static ArrayList<String> entryModuleNameArray = new ArrayList<String>(0);

	// text record
	private static ArrayList<Integer> addressArray = new ArrayList<Integer>(0);
	private static ArrayList<String> machineCodeArray = new ArrayList<String>(0);
	private static ArrayList<String> relocationS1CodeArray = new ArrayList<String>(0);
	private static ArrayList<String> relocationS2CodeArray = new ArrayList<String>(0);
	private static ArrayList<String> relocationS3CodeArray = new ArrayList<String>(0);
	private static ArrayList<String> relocationS4CodeArray = new ArrayList<String>(0);
	private static ArrayList<String> relocationS5CodeArray = new ArrayList<String>(0);

	private static ArrayList<String> adjustmentSignS1Array = new ArrayList<String>(0);
	private static ArrayList<String> adjustmentSignS2Array = new ArrayList<String>(0);
	private static ArrayList<String> adjustmentSignS3Array = new ArrayList<String>(0);
	private static ArrayList<String> adjustmentSignS4Array = new ArrayList<String>(0);
	private static ArrayList<String> adjustmentSignS5Array = new ArrayList<String>(0);
	
	private static ArrayList<String> referencedS1SymbolArray = new ArrayList<String>(0);
	private static ArrayList<String> referencedS2SymbolArray = new ArrayList<String>(0);
	private static ArrayList<String> referencedS3SymbolArray = new ArrayList<String>(0);
	private static ArrayList<String> referencedS4SymbolArray = new ArrayList<String>(0);
	private static ArrayList<String> referencedS5SymbolArray = new ArrayList<String>(0);
	private static ArrayList<String> textModuleNameArray = new ArrayList<String>(0);


	// end record
	private static Integer totalRecords = 2;
	
	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	
	public static void resetObjectFile() {
		// header record
		 moduleName = "DefaultName";
		 programLength = 0;
		 loadAddress = 0;
		 numberOfLinkingRecords = 0;
		 numberOfTextRecords = 0;
		 startAddress = 0;
		 tressel = "TRESSEL";
		 versionNumber = "3";
		 revisionNumber = "2";

		// linking record
		 entryNameArray = new ArrayList<String>(0);
		 entryAddressArray = new ArrayList<Integer>(0);
		 entryModuleNameArray = new ArrayList<String>(0);

		// text record
		 addressArray = new ArrayList<Integer>(0);
		 machineCodeArray = new ArrayList<String>(0);
		 relocationS1CodeArray = new ArrayList<String>(0);
		 relocationS2CodeArray = new ArrayList<String>(0);
		 relocationS3CodeArray = new ArrayList<String>(0);
		 relocationS4CodeArray = new ArrayList<String>(0);
		 relocationS5CodeArray = new ArrayList<String>(0);
		 
		 adjustmentSignS1Array = new ArrayList<String>(0);
		 adjustmentSignS2Array = new ArrayList<String>(0);
		 adjustmentSignS3Array = new ArrayList<String>(0);
		 adjustmentSignS4Array = new ArrayList<String>(0);
		 adjustmentSignS5Array = new ArrayList<String>(0);

		 referencedS1SymbolArray = new ArrayList<String>(0);
		 referencedS2SymbolArray = new ArrayList<String>(0);
		 referencedS3SymbolArray = new ArrayList<String>(0);
		 referencedS4SymbolArray = new ArrayList<String>(0);
		 referencedS5SymbolArray = new ArrayList<String>(0);
		 textModuleNameArray = new ArrayList<String>(0);

		// end record
		 totalRecords = 2;
	}

	/**
	 * Module Name: startObjectFile
	 * 
	 * Description: Constructs an empty object file
	 * 
	 * Calling Sequence: ObjectFile objectFileName = new ObjectFile (moduleName,
	 * loadAddress, startAddress);
	 * 
	 * Input Parameters: (String) moduleName: the name of the module that the
	 * ObjectFile is for, (Integer) loadAddress: the assembler assigned program
	 * load address, (Integer) startAddress: the execution start address for the
	 * module
	 * 
	 * Output Parameters: none
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static void startObjectFile(String moduleName, Integer loadAddress,
			Integer startAddress) {
		ObjectFile.moduleName = moduleName;
		ObjectFile.loadAddress = loadAddress;
		ObjectFile.startAddress = startAddress;

	}

	/**
	 * Module Name: addEntry
	 * 
	 * Description: adds an entry to the entry array
	 * 
	 * Calling Sequence: objectFile.addEntry(entryName, entryAddress,
	 * moduleName);
	 * 
	 * Input Parameters: (String) entryName: the name of the entry, (Integer)
	 * entryAddress: the address of the Entry, (String) moduleName: the name of
	 * the module where the entry came from
	 * 
	 * Output Parameters: none
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addEntry(String entryName, Integer entryAddress,
			String moduleName) {
		numberOfLinkingRecords ++;
		totalRecords++;
		entryNameArray.add(entryName);
		entryAddressArray.add(entryAddress);
		entryModuleNameArray.add(moduleName);

	}

	/**
	 * Module Name: addTextRecord
	 * 
	 * Description: adds a Text Record to the text record arrays
	 * 
	 * Calling Sequence: objectFile.addTextRecord(address, machineCode,
	 * relocationCode, referencedSymbol, moduleName);
	 * 
	 * Input Parameters: (Integer) address: the address of the text record,
	 * (String) machineCode: the 24 bit machine code at that address, (String)
	 * relocationCode: the relocation code for the data at that address,
	 * (String) referencedSymbol: the referenced symbol for the
	 * directive/instruction, (String) moduleName: the name of the module this
	 * line of code came from
	 * 
	 * Output Parameters: none
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static void addTextRecord(Integer address, String machineCode,
			String relocationS1Code, String adjustmentSignS1, String referencedS1Symbol) {
		if(referencedS1Symbol.charAt(0)=='-' || referencedS1Symbol.charAt(0)=='+'){
			referencedS1Symbol = referencedS1Symbol.substring(1);
		}
		numberOfTextRecords++;
		totalRecords++;
		addressArray.add(address);
		programLength = (address-loadAddress+1);
		machineCodeArray.add(machineCode);
		relocationS1CodeArray.add(relocationS1Code);
		relocationS2CodeArray.add(null);
		relocationS3CodeArray.add(null);
		relocationS4CodeArray.add(null);
		relocationS5CodeArray.add(null);
		referencedS1SymbolArray.add(referencedS1Symbol);
		referencedS2SymbolArray.add(null);
		referencedS3SymbolArray.add(null);
		referencedS4SymbolArray.add(null);
		referencedS5SymbolArray.add(null);
		adjustmentSignS1Array.add(adjustmentSignS1);
		adjustmentSignS2Array.add(null);
		adjustmentSignS3Array.add(null);
		adjustmentSignS4Array.add(null);
		adjustmentSignS5Array.add(null);
		textModuleNameArray.add(ObjectFile.moduleName);
	}
	
	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	
	public static void addTextRecord(Integer address, String machineCode,
			String relocationS1Code, String adjustmentSignS1, String referencedS1Symbol, String relocationS2Code,
			String adjustmentSignS2, String referencedS2Symbol) {
		if(referencedS1Symbol.charAt(0)=='-' || referencedS1Symbol.charAt(0)=='+'){
			referencedS1Symbol = referencedS1Symbol.substring(1);
		}
		if(referencedS2Symbol.charAt(0)=='-' || referencedS2Symbol.charAt(0)=='+'){
			referencedS2Symbol = referencedS2Symbol.substring(1);
		}
		numberOfTextRecords++;
		totalRecords++;
		addressArray.add(address);
		programLength = (address-loadAddress+1);
		machineCodeArray.add(machineCode);
		relocationS1CodeArray.add(relocationS1Code);
		relocationS2CodeArray.add(relocationS2Code);
		relocationS3CodeArray.add(null);
		relocationS4CodeArray.add(null);
		relocationS5CodeArray.add(null);
		referencedS1SymbolArray.add(referencedS1Symbol);
		referencedS2SymbolArray.add(referencedS2Symbol);
		referencedS3SymbolArray.add(null);
		referencedS4SymbolArray.add(null);
		referencedS5SymbolArray.add(null);
		adjustmentSignS1Array.add(adjustmentSignS1);
		adjustmentSignS2Array.add(adjustmentSignS2);
		adjustmentSignS3Array.add(null);
		adjustmentSignS4Array.add(null);
		adjustmentSignS5Array.add(null);
		textModuleNameArray.add(ObjectFile.moduleName);
	}
	public static void addTextRecord(Integer address, String machineCode,
			String relocationS1Code, String adjustmentSignS1, String referencedS1Symbol, String relocationS2Code,String adjustmentSignS2, String referencedS2Symbol,
			String relocationS3Code,String adjustmentSignS3, String referencedS3Symbol) {
		if(referencedS1Symbol.charAt(0)=='-' || referencedS1Symbol.charAt(0)=='+'){
			referencedS1Symbol = referencedS1Symbol.substring(1);
		}
		if(referencedS2Symbol.charAt(0)=='-' || referencedS2Symbol.charAt(0)=='+'){
			referencedS2Symbol = referencedS2Symbol.substring(1);
		}
		if(referencedS3Symbol.charAt(0)=='-' || referencedS3Symbol.charAt(0)=='+'){
			referencedS3Symbol = referencedS3Symbol.substring(1);
		}
		numberOfTextRecords++;
		totalRecords++;
		addressArray.add(address);
		programLength = (address-loadAddress+1);
		machineCodeArray.add(machineCode);
		relocationS1CodeArray.add(relocationS1Code);
		relocationS2CodeArray.add(relocationS2Code);
		relocationS3CodeArray.add(relocationS3Code);
		relocationS4CodeArray.add(null);
		relocationS5CodeArray.add(null);
		referencedS1SymbolArray.add(referencedS1Symbol);
		referencedS2SymbolArray.add(referencedS2Symbol);
		referencedS3SymbolArray.add(referencedS3Symbol);
		referencedS4SymbolArray.add(null);
		referencedS5SymbolArray.add(null);
		adjustmentSignS1Array.add(adjustmentSignS1);
		adjustmentSignS2Array.add(adjustmentSignS2);
		adjustmentSignS3Array.add(adjustmentSignS3);
		adjustmentSignS4Array.add(null);
		adjustmentSignS5Array.add(null);
		textModuleNameArray.add(ObjectFile.moduleName);
	}
	public static void addTextRecord(Integer address, String machineCode,
			String relocationS1Code, String adjustmentSignS1, String referencedS1Symbol, String relocationS2Code,String adjustmentSignS2, String referencedS2Symbol,
			String relocationS3Code,String adjustmentSignS3, String referencedS3Symbol,
			String relocationS4Code,String adjustmentSignS4, String referencedS4Symbol) {
		if(referencedS1Symbol.charAt(0)=='-' || referencedS1Symbol.charAt(0)=='+'){
			referencedS1Symbol = referencedS1Symbol.substring(1);
		}
		if(referencedS2Symbol.charAt(0)=='-' || referencedS2Symbol.charAt(0)=='+'){
			referencedS2Symbol = referencedS2Symbol.substring(1);
		}
		if(referencedS3Symbol.charAt(0)=='-' || referencedS3Symbol.charAt(0)=='+'){
			referencedS3Symbol = referencedS3Symbol.substring(1);
		}
		if(referencedS4Symbol.charAt(0)=='-' || referencedS4Symbol.charAt(0)=='+'){
			referencedS4Symbol = referencedS4Symbol.substring(1);
		}
		numberOfTextRecords++;
		totalRecords++;
		addressArray.add(address);
		programLength = (address-loadAddress+1);
		machineCodeArray.add(machineCode);
		relocationS1CodeArray.add(relocationS1Code);
		relocationS2CodeArray.add(relocationS2Code);
		relocationS3CodeArray.add(relocationS3Code);
		relocationS4CodeArray.add(null);
		relocationS5CodeArray.add(null);
		referencedS1SymbolArray.add(referencedS1Symbol);
		referencedS2SymbolArray.add(referencedS2Symbol);
		referencedS3SymbolArray.add(referencedS3Symbol);
		referencedS4SymbolArray.add(null);
		referencedS5SymbolArray.add(null);
		adjustmentSignS1Array.add(adjustmentSignS1);
		adjustmentSignS2Array.add(adjustmentSignS2);
		adjustmentSignS3Array.add(adjustmentSignS3);
		adjustmentSignS4Array.add(null);
		adjustmentSignS5Array.add(null);
		textModuleNameArray.add(ObjectFile.moduleName);
	}
	public static void addTextRecord(Integer address, String machineCode,
			String relocationS1Code, String adjustmentSignS1, String referencedS1Symbol, String relocationS2Code,String adjustmentSignS2, String referencedS2Symbol,
			String relocationS3Code,String adjustmentSignS3, String referencedS3Symbol,
			String relocationS4Code,String adjustmentSignS4, String referencedS4Symbol,
			String relocationS5Code,String adjustmentSignS5, String referencedS5Symbol) {
		if(referencedS1Symbol.charAt(0)=='-' || referencedS1Symbol.charAt(0)=='+'){
			referencedS1Symbol = referencedS1Symbol.substring(1);
		}
		if(referencedS2Symbol.charAt(0)=='-' || referencedS2Symbol.charAt(0)=='+'){
			referencedS2Symbol = referencedS2Symbol.substring(1);
		}
		if(referencedS3Symbol.charAt(0)=='-' || referencedS3Symbol.charAt(0)=='+'){
			referencedS3Symbol = referencedS3Symbol.substring(1);
		}
		if(referencedS4Symbol.charAt(0)=='-' || referencedS4Symbol.charAt(0)=='+'){
			referencedS4Symbol = referencedS4Symbol.substring(1);
		}
		if(referencedS5Symbol.charAt(0)=='-' || referencedS5Symbol.charAt(0)=='+'){
			referencedS5Symbol = referencedS5Symbol.substring(1);
		}
		numberOfTextRecords++;
		totalRecords++;
		addressArray.add(address);
		programLength = (address-loadAddress+1);
		machineCodeArray.add(machineCode);
		relocationS1CodeArray.add(relocationS1Code);
		relocationS2CodeArray.add(relocationS2Code);
		relocationS3CodeArray.add(relocationS3Code);
		relocationS4CodeArray.add(null);
		relocationS5CodeArray.add(null);
		referencedS1SymbolArray.add(referencedS1Symbol);
		referencedS2SymbolArray.add(referencedS2Symbol);
		referencedS3SymbolArray.add(referencedS3Symbol);
		referencedS4SymbolArray.add(null);
		referencedS5SymbolArray.add(null);
		adjustmentSignS1Array.add(adjustmentSignS1);
		adjustmentSignS2Array.add(adjustmentSignS2);
		adjustmentSignS3Array.add(adjustmentSignS3);
		adjustmentSignS4Array.add(null);
		adjustmentSignS5Array.add(null);
		textModuleNameArray.add(ObjectFile.moduleName);
	}

	/**
	 * Module Name: moduleName
	 * 
	 * Description: returns the module name for the object file
	 * 
	 * Calling Sequence: String = objectFile.textModuleName();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the module name for the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String moduleName() {
		return moduleName;
	}

	/**
	 * Module Name: date
	 * 
	 * Description: returns the date for the object file
	 * 
	 * Calling Sequence: String = objectFile.date();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: String
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String date() {
		DateFormat dateFormat = new SimpleDateFormat("yyyy:ddd");
		Date date = new Date();
		return dateFormat.format(date);
	}

	/**
	 * Module Name: time
	 * 
	 * Description: returns the time for the object file
	 * 
	 * Calling Sequence: String = objectFile.time();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: String
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String time() {
		DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
		Date date = new Date();
		return dateFormat.format(date);
	}

	/**
	 * Module Name: programLength
	 * 
	 * Description: returns the program length for the object
	 * 
	 * Calling Sequence: String = objectFile.programLength();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the program length
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed type from integer to string
	public static String programLength() {
		String length = new String();
		length = Integer.toHexString(programLength);
		while(length.length()<4){
			length = "0"+length.toUpperCase();
		}
		return length;
		// dont worry about hex for now
	}

	/**
	 * Module Name: loadAddress
	 * 
	 * Description: returns the load address for the object
	 * 
	 * Calling Sequence: String = objectFile.loadAddress();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the load address of the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */

	public static String loadAddress() {
		String address = new String();
		address = Integer.toHexString(loadAddress);
		while(address.length()<4){
			address = "0"+address.toUpperCase();
		}
		return address;
		// dont worry about hex for now
	}

	/**
	 * Module Name: numberOfLinkingRecords
	 * 
	 * Description: returns the number of linking records for the object file
	 * 
	 * Calling Sequence: String = objectFile.numberOfLinkingRecords();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the number of Linking Records
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed type from integer to string
	public static String numberOfLinkingRecords() {
		String numberOfRecords = new String();
		numberOfRecords = Integer.toHexString(numberOfLinkingRecords);
		while(numberOfRecords.length()<4){
			numberOfRecords = "0"+numberOfRecords.toUpperCase();
		}
		return numberOfRecords;
		// dont worry about hex for now
	}

	/**
	 * Module Name: numberOfTextRecords
	 * 
	 * Description: returns the number of text records for the object file
	 * 
	 * Calling Sequence: String = objectFile.numberOfTextRecords();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the number of Text Records
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed type from integer to string
	public static String numberOfTextRecords() {
		String numberOfRecords = new String();
		numberOfRecords = Integer.toHexString(numberOfTextRecords);
		while(numberOfRecords.length()<4){
			numberOfRecords = "0"+numberOfRecords.toUpperCase();
		}
		return numberOfRecords;
		// dont worry about hex for now
	}

	/**
	 * Module Name: startAddress
	 * 
	 * Description: returns the start address for the object file
	 * 
	 * Calling Sequence: String = objectFile.startAddress();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the start address of the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed from Integer to String
	public static String startAddress() {
		String address = new String();
		address = Integer.toHexString(startAddress);
		while(address.length()<4){
			address = "0"+address.toUpperCase();
		}
		return address;
		// dont worry about converting to HEX
	}

	/**
	 * Module Name: tressel
	 * 
	 * Description: returns the tressel field for the object file
	 * 
	 * Calling Sequence: String = objectFile.tressel();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the tressel field of the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String tressel() {
		return tressel;
	}

	/**
	 * Module Name: versionNumber
	 * 
	 * Description: returns the version number field for the object file
	 * 
	 * Calling Sequence: String = objectFile.versionNumber();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the version number of the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String versionNumber() {
		return versionNumber;
	}

	/**
	 * Module Name: revisionNumber
	 * 
	 * Description: returns the revision number field for the object file
	 * 
	 * Calling Sequence: String = objectFile.versionNumber();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (String) the revision number of the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String revisionNumber() {
		return revisionNumber;
	}

	/**
	 * Module Name: entryName
	 * 
	 * Description: returns the entry name at a position in the entry array
	 * 
	 * Calling Sequence: String = objectFile.entryName();
	 * 
	 * Input Parameters: (Integer) entryNumber: the position of the entry name
	 * to be returned
	 * 
	 * Output Parameters: (String) the name of the entry the given position
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String entryName(int entryNumber) {
		return entryNameArray.get(entryNumber);
	}
	public static int entryLength(){
		return entryNameArray.size();
	}

	/**
	 * Module Name: entryAddress
	 * 
	 * Description: returns the entry address for an entry in the entry array
	 * 
	 * Calling Sequence: Integer = objectFile.entryAddress();
	 * 
	 * Input Parameters: (String) entryName: the name of the entry whose address
	 * you want
	 * 
	 * Output Parameters: (Integer) the address of the entry
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed from Integer to String
	public static String entryAddress(int entryNumber) {
		String address = new String();
		address = Integer.toHexString(entryAddressArray.get(entryNumber));
		while(address.length()<4){
			address = "0"+address.toUpperCase();
		}
		return address;
		// dont worry about HEX for now
	}

	/**
	 * Module Name: entryModuleName
	 * 
	 * Description: returns the name of the module that contains the given entry
	 * 
	 * Calling Sequence: String = objectFile.entryAddress();
	 * 
	 * Input Parameters: (String) entryName: the name of the entry whose module
	 * name you want
	 * 
	 * Output Parameters: (String) the name of the module that contains the
	 * entry
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String entryModuleName(int entryNumber) {
		return entryModuleNameArray.get(entryNumber);
	}

	/**
	 * Module Name: address
	 * 
	 * Description: returns the address of the text record at the given position
	 * in the address array
	 * 
	 * Calling Sequence: Integer = objectFile.address(textRecordPosition);
	 * 
	 * Input Parameters: (Integer) textRecordPosition: the position in the
	 * addressArray of the address to be returned
	 * 
	 * Output Parameters: (Integer) the address at the given position in the
	 * addressArray
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed from integer to string
	public static String address(Integer textRecordPosition) {
		String address = new String();
		address = Integer.toHexString(addressArray.get(textRecordPosition));
		while(address.length()<4){
			address = "0"+address.toUpperCase();
		}
		return address;
	}
	public static int textLength(){
		return addressArray.size();
	}

	/**
	 * Module Name: machineCode
	 * 
	 * Description: returns the machine of the text record at the the given
	 * address
	 * 
	 * Calling Sequence: String = objectFile.machineCode(address);
	 * 
	 * Input Parameters: (Integer) address: the address of the machine code to
	 * be returned
	 * 
	 * Output Parameters: (String) the machine code at the given address
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String machineCode(Integer address) {
		String mCode = new String();
		Integer binValue = Integer.parseInt(machineCodeArray.get(address), 2);
		mCode = Integer.toHexString(binValue).toUpperCase();
		while(mCode.length()<6){
			mCode = "0"+mCode;
		}
		return mCode;
	}

	/**
	 * Module Name: relocationCode
	 * 
	 * Description: returns the relocation code of the text record at the the
	 * given address
	 * 
	 * Calling Sequence: String = objectFile.relocationCode(address);
	 * 
	 * Input Parameters: (Integer) address: the address of the relocation code
	 * to be returned
	 * 
	 * Output Parameters: (String) the relocation code at the given address
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String relocationS2Code(Integer address) {
		return relocationS2CodeArray.get(address);
	}
	public static String relocationS1Code(Integer address) {
		return relocationS1CodeArray.get(address);
	}
	public static String relocationS3Code(Integer address) {
		return relocationS3CodeArray.get(address);
	}
	public static String relocationS4Code(Integer address) {
		return relocationS4CodeArray.get(address);
	}
	public static String relocationS5Code(Integer address) {
		return relocationS5CodeArray.get(address);
	}

	/**
	 * Module Name: referencedSymbol
	 * 
	 * Description: returns the referencedSymbol of the text record at the the
	 * given address
	 * 
	 * Calling Sequence: String = objectFile.referencedSymbol(address);
	 * 
	 * Input Parameters: (Integer) address: the address of the referenced symbol
	 * to be returned
	 * 
	 * Output Parameters: (String) the referenced symbol at the given address
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String referencedS1Symbol(Integer address) {
		return referencedS1SymbolArray.get(address);
	}
	public static String referencedS2Symbol(Integer address) {
		return referencedS2SymbolArray.get(address);
	}
	public static String referencedS3Symbol(Integer address) {
		return referencedS3SymbolArray.get(address);
	}
	public static String referencedS4Symbol(Integer address) {
		return referencedS4SymbolArray.get(address);
	}
	public static String referencedS5Symbol(Integer address) {
		return referencedS5SymbolArray.get(address);
	}

	/**
	 * Module Name: textModuleName
	 * 
	 * Description: returns the module name of the text record at the the given
	 * address
	 * 
	 * Calling Sequence: String = objectFile.textModuleName(address);
	 * 
	 * Input Parameters: (Integer) address: the address of the module name to be
	 * returned
	 * 
	 * Output Parameters: (String) the module name at the given address
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String textModuleName(Integer address) {
		return textModuleNameArray.get(address);
	}

	/**
	 * Module Name: totalRecords
	 * 
	 * Description: returns the total number of records (entry and text) in the
	 * object file
	 * 
	 * Calling Sequence: Integer = objectFile.totalRecords();
	 * 
	 * Input Parameters: none
	 * 
	 * Output Parameters: (Integer) total number of records in the object file
	 * 
	 * Error Conditions Tested:
	 * 
	 * Error Messages Generated:
	 * 
	 * Original Author:
	 * 
	 * Procedure Creation Date:
	 * 
	 * Modification Log: Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	//changed from integer to string
	public static String totalRecords() {
		String size = new String();
		size = Integer.toHexString(totalRecords);
		while(size.length()<4){
			size = "0"+size.toUpperCase();
		}
		return size;
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String adjustmentSignS1(int i) {
		if(adjustmentSignS1Array.get(i) == "+" || adjustmentSignS1Array.get(i) == "-" || adjustmentSignS1Array.get(i) == "*" || adjustmentSignS1Array.get(i) == "/"){
		return adjustmentSignS1Array.get(i);
		}
		else{
			return "INVALID ADJUSTMENT SIGN";
		}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String adjustmentSignS2(int i) {
		if(adjustmentSignS2Array.get(i) == "+" || adjustmentSignS2Array.get(i) == "-" || adjustmentSignS2Array.get(i) == "*" || adjustmentSignS2Array.get(i) == "/"){
			return adjustmentSignS2Array.get(i);
			}
			else{
				return "INVALID ADJUSTMENT SIGN";
			}
	}

	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String adjustmentSignS3(int i) {
		if(adjustmentSignS3Array.get(i) == "+" || adjustmentSignS3Array.get(i) == "-" || adjustmentSignS3Array.get(i) == "*" || adjustmentSignS3Array.get(i) == "/"){
			return adjustmentSignS3Array.get(i);
			}
			else{
				return "INVALID ADJUSTMENT SIGN";
			}
	}
	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String adjustmentSignS4(int i) {
		if(adjustmentSignS4Array.get(i) == "+" || adjustmentSignS4Array.get(i) == "-" || adjustmentSignS4Array.get(i) == "*" || adjustmentSignS4Array.get(i) == "/"){
			return adjustmentSignS4Array.get(i);
			}
			else{
				return "INVALID ADJUSTMENT SIGN";
			}
	}
	/**
	 * @modulename 
	 * 
	 * @description 
	 * 
	 * @callsequence  
	 * 
	 * @inparam 
	 * 
	 * @outparam 
	 * 
	 * @errorstested 
	 * 
	 * @errorsgenerated 
	 * 
	 * @author
	 * 
	 * @createdate
	 * 
	 * @modlog Who/When/Why
	 * 
	 * Coding Standards Met: "Signed Code Leader(Jaron)"
	 * 
	 * Testing Standards Met: "Signed Test Leader(Jamie)"
	 */
	public static String adjustmentSignS5(int i) {
		if(adjustmentSignS5Array.get(i) == "+" || adjustmentSignS5Array.get(i) == "-" || adjustmentSignS5Array.get(i) == "*" || adjustmentSignS5Array.get(i) == "/"){
			return adjustmentSignS5Array.get(i);
			}
			else{
				return "INVALID ADJUSTMENT SIGN";
			}
	}
}
